<template>
    <div class="Menu">
        <!--        面包导航-->
        <el-breadcrumb separator-class="el-icon-arrow-right">
            <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
            <el-breadcrumb-item>用户管理</el-breadcrumb-item>
            <el-breadcrumb-item>权限列表</el-breadcrumb-item>
        </el-breadcrumb>
        <!--        卡片-->
        <el-card class="box-card">
            <!--            搜索区域-->
            <el-row :gutter="20">
                <el-col :span="8">
<!--                    <el-input placeholder="请输入账号或者姓名"  v-model="queryInfo.name" clearable>-->
<!--                        &lt;!&ndash;                        <el-select  slot="prepend" placeholder="请选择" >&ndash;&gt;-->
<!--                        &lt;!&ndash;                            <el-option label="餐厅名" value="1"></el-option>&ndash;&gt;-->
<!--                        &lt;!&ndash;                            <el-option label="订单号" value="2"></el-option>&ndash;&gt;-->
<!--                        &lt;!&ndash;                            <el-option label="用户电话" value="3"></el-option>&ndash;&gt;-->
<!--                        &lt;!&ndash;                        </el-select>&ndash;&gt;-->
<!--                        <el-button slot="append" icon="el-icon-search" ></el-button>-->
<!--                    </el-input>-->
                </el-col>
            </el-row>
            <!--            表格区域-->
            <el-table :data="menuList" border stripe>
                <el-table-column type="index"></el-table-column>
                <el-table-column label="权限名" prop="name"></el-table-column>
                <el-table-column label="地址" prop="url"></el-table-column>
                <el-table-column label="级别" prop="lv">
                    <template slot-scope="scope">
                        <el-tag v-if="scope.row.lv ===0">一级</el-tag>
                        <el-tag type="success" v-else-if="scope.row.lv ===1">二级</el-tag>
                        <el-tag type="warning" v-else>三级</el-tag>
                    </template>
                </el-table-column>
<!--                <el-table-column label="创建时间" prop="createDate"></el-table-column>-->
            </el-table>
            <!--                分页-->
            <el-pagination
                    @size-change="handleSizeChange"
                    @current-change="handleCurrentChange"
                    :current-page="queryInfo.page"
                    :page-sizes="[5,10,20,50]"
                    :page-size="queryInfo.size"
                    layout="total, sizes, prev, pager, next, jumper"
                    :total="total">
            </el-pagination>
        </el-card>
    </div>
</template>

<script>
    export default {
        name: "Menu",
        data(){
            return{
                //权限列表
                menuList: [],
                queryInfo:{
                    page: 1,
                    size: 10
                },
                //权限总数
                total: 0,

            }
        },
        created() {
            this.getMenuList();
        },
        methods:{
            async getMenuList(){
                const {data: res} = await this.$http.get('Menu/getAllMenuList',{
                    params: this.queryInfo
                })
                this.menuList = res.data.data
                this.total = res.data.total
            },
            //监听pagesize的改变
            handleSizeChange(newSize){
                this.queryInfo.size = newSize
                this.getMenuList()
            },
            //页码值改变
            handleCurrentChange(newPage){
                this.queryInfo.page = newPage
                this.getMenuList()
            },
        }
    }
</script>

<style lang="less" scoped>

</style>